import request from '@/utils/request'

// 完成任务
export function complete(data) {
  return request({
    url: '/workflow/task/complete',
    method: 'post',
    data: data
  })
}

// 委派任务
export function delegate(data) {
  return request({
    url: '/workflow/task/delegate',
    method: 'post',
    data: data
  })
}

// 转办任务
export function transfer(data) {
  return request({
    url: '/workflow/task/transfer',
    method: 'post',
    data: data
  })
}

// 批量转办任务
export function batchTransfer(data) {
  return request({
    url: '/workflow/task/batchTransfer',
    method: 'post',
    data: data
  })
}

// 退回任务
export function returnTask(data) {
  return request({
    url: '/workflow/task/return',
    method: 'post',
    data: data
  })
}

// 拒绝任务
export function rejectTask(data) {
  return request({
    url: '/workflow/task/reject',
    method: 'post',
    data: data
  })
}

// 签收任务
export function claimTask(data) {
  return request({
    url: '/workflow/task/claim',
    method: 'post',
    data: data
  })
}

// 可退回任务列表
export function returnList(data) {
  return request({
    url: '/workflow/task/returnList',
    method: 'post',
    data: data
  })
}

// 撤销任务
export function instanceCancel(data) {
  return request({
    url: '/workflow/instance/cancel',
    method: 'post',
    data: data
  })
}

/**
 * 更新任务状态
 * businessKey: this.$route.query['cur_businessKey'],
   businessStatus: "2", // 1: 草稿，2:进行中，3: 已完成，4：已终止，5: 已撤销
   taskId: this.$route.query.taskId,
   operator: this.$store.state.user.userInfo.userId
 * @param {*} data 
 * @returns 
 */
export function reqUpdateWorkStatus(data) {
  return request({
    url: '/work/orderState/insertorUpdate',
    method: 'post',
    data: data
  })
}